In MPEG-2, the functions of system clock recovery and video and audio data synchronization are mainly implemented according to a Program Clock Reference (PCR) and Presentation Time Stamps (PTSs) of video and audio data. The PCR is usually set in header information of a transmission stream, and is used to recover a System Time Clock (STC) the same as an encoding end. The PTS is mainly set in header information of a Packetized Elementary Stream, and is used to indicate presentation time of current data.
It is specified in MPEG-2 that both the PCR and the PTS in the transmission stream are sampled values of the same system clock. At a decoding end, a local STC is recovered according to a captured PCR, to serve as a reference for controlling synchronization of video and audio data. Then, a captured PTS of a certain stream is compared with the STC, and the received data is processed according to a comparison result. The process specifically includes the following.
(1) If PTS>STC, it is determined that the data does not reach the presentation time, and the data needs to be buffered in a buffer.
(2) If PTS=STC, it is determined that currently the data needs to be presented.
(3) If PTS<STC, it indicates that the data expires, and needs to be discarded.
Through the preceding process, the video data and the audio data are synchronized with their respective STC, so that the video data and the audio data are synchronously played.
In a case that the PCR cannot be obtained in the system, a terminal MPEG-2 receiver usually plays the corresponding data by directly adopting an asynchronous play mode.
In the implementation of the present disclosure, the inventor found that the prior art at least has the following problem: when the PCR cannot be obtained in the system, the video and audio signals are played by directly adopting the asynchronous play mode, that is, the video information and the audio information cannot be synchronously played, resulting in that the receiving effect of the video signals and the audio signals is affected.